
public class TemperatureController {
	TemperatureModel model;
	
	public TemperatureController (TemperatureModel model){
		this.model = model;
	}
	
	public void SetCelciusTemperature(double temp){
		this.setCelsius(temp);
	}
	
	public void IncrementCelciusTemperature(){
		double temp = this.model.getC() + 1;
		this.setCelsius(temp);
	}
	
	public void DecrementCelciusTemperature(){
		this.setCelsius(this.model.getC() - 1);		
	}
	
	private void setCelsius(double temp) {
		if (temp >= -17.78) {
			this.model.setC(temp);		
		}
		else {
			this.model.setC(this.model.getC());	
		}		
	}
	
	public void SetKelvinTemperature(double temp){
		this.setKelvin(temp);
	}
	
	public void IncrementKelvinTemperature(){
		this.setKelvin(this.model.getK() + 1);		
	}
	
	public void DecrementKelvinTemperature(){
		this.setKelvin(this.model.getK() - 1);		
	}
	
	private void setKelvin(double temp) {
		if (temp >= -255.38) {
			this.model.setK(temp);		
		}
		else {
			this.model.setK(this.model.getK());	
		}		
	}
	
	public void SetFahrenheitTemperature(double temp){
		this.setFahrenheit(temp);
	}
	
	public void IncrementFahrenheitTemperature(){
		this.setFahrenheit(this.model.getF() + 1);		
	}
	
	public void DecrementFahrenheitTemperature(){
		this.setFahrenheit(this.model.getF() - 1);		
	}
	
	private void setFahrenheit(double temp) {
		if (temp >= 0) {
			this.model.setF(temp);		
		}
		else {
			this.model.setF(this.model.getF());	
		}		
	}
}
